<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>  
<fmt:setLocale value="pt-BR" />  

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<jsp:include page="/WEB-INF/jsp/head.jsp"/>
</head>
<body>

	<table width="70%" align="center" cellspacing="10" style="border-style:solid;border-width:2px;border-bottom-color: black;">
		<tr>
			<td colspan="2" align="center"><b>RELATÓRIO DE ESTABELECIMENTOS SUSPEITOS</b></td>
		</tr>
		<tr>
			<td colspan="2" align="center"><b>SISTEMA SCAF</b></td>
		</tr>
		<tr>
			<td colspan="2" align="center">&nbsp;</td>
		</tr>
		<tr>
			<td align="left">Período: ${datainicial} a ${dataFinal}</td>
			<td align="right">Usuário: ${usuario}</td>
		</tr>
		<tr>
			<td align="left">País: ${pais}</td>
			<td align="right">Data Emissão: ${dataAtual}</td>
		</tr>
		<tr>
			<td colspan="2" align="left">Estado: ${estado}</td>
		</tr>
		<tr>
			<td colspan="2" align="left">Cidade: ${cidade}</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				<table width="100%" border="1">
					<tr>
						<td align="center"><b>Código Estabelecimento</b></td>
						<td align="center"><b>Nome</b></td>
						<td align="center"><b>Cidade</b></td>
						<td align="center"><b>UF</b></td>
						<td align="center"><b>País</b></td>
						<td align="center"><b>Valor Fraudulento</b></td>
					</tr>
					
					<c:set var="total" value="0.0" />
					
					<c:forEach items="${itens}" var="item">
						<tr>
							<td align="center">${item.codigo}</td>
							<td align="left">${item.nome}</td>
							<td align="left">${item.cidade}</td>
							<td align="center">${item.uf}</td>
							<td align="center">${item.pais}</td>
							<td align="right"><fmt:formatNumber value="${item.valorFraudulento}" minFractionDigits="2" type="currency"/></td>
							<c:set var="total" value="${ total + item.valorFraudulento}" />
						</tr>
					</c:forEach>
				</table>
			</td>
		</tr>			
		<tr>
			<td colspan="2" align="right">Total: <fmt:formatNumber value="${total}" minFractionDigits="2" type="currency"/></td>
		</tr>
			
	</table>
		 	
</body>
</html>